﻿@using CCTV.Common
@model List<ApplicationUser>

<table style="border: 1px solid black">
<tr>
    <td colspan="3">
        <label class="smalllabel">Add user: </label><input type="text" id="txtUserToAdd" value="" />
        <input type="button" id="btnAddUser" value="+" onclick="addUser()" class="smallbutton" />
    </td>
</tr>
        @foreach (ApplicationUser usr in Model)
        {
            <tr style="background-color: #DDDDDD">
                <td class="smalllabel">
                    @Html.Raw(usr.UserName)
                </td>
                <td class="smalllabel">
                    @Html.Raw(usr.LastActivity.HasValue? usr.LastActivity.Value.ToString("dd/MM HH:mm"): string.Empty)
                </td>
                <td rowspan="2" style="border-bottom: 1px solid black" align="center">
                @if (!usr.IsAdmin)
                {
                    <input type="button" id="@Html.Raw("btnDeleteUser" + usr.UserName)" value="x" onclick="deleteUser('@Html.Raw(usr.UserName)')" class="smallbutton" />
                }
                </td>
            </tr>
                 <tr style="border-bottom: 1px solid black">
                <td colspan="2" class="smalllabel">
                    @Html.Raw(usr.Password)
                </td>
            </tr>
        }
        <tr>
            <td colspan="3" align="center">
                <input type="button" id="btnRefreshUsers" value="Refresh" onclick="reloadUsers()"/>
            </td>
        </tr>
</table>